GtkScrolledWindow: Avoid a test failure
authorMatthias Clasen <mclasen@redhat.com>
Thu, 22 May 2014 10:00:09 +0000 (06:00 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 22 May 2014 10:00:09 +0000 (06:00 -0400)
The change to take out unneeded NULL checks requires some care
at startup: we check both adjustments when any of them changes;
we need to do those checks in the same order in which we create
the scrollbars, otherwise we'll try to get the adjustment of
the vscrollbar when we just set the up the hscrollbars' adjustment.

gtk/gtkscrolledwindow.c

index f8d1582f41e2053c2ad06c99b66dd6877bd0de46..a6353c711ccc9bdb1ad4f206afcf7100b0e1a1e2 100644 (file)
@@ -2890,10 +2890,10 @@ gtk_scrolled_window_adjustment_value_changed (GtkAdjustment *adjustment,
     return;
 
   /* Ensure GtkAdjustment and unclamped values are in sync */
-  if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)))
-    priv->unclamped_vadj_value = gtk_adjustment_get_value (adjustment);
-  else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)))
+  if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)))
     priv->unclamped_hadj_value = gtk_adjustment_get_value (adjustment);
+  else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)))
+    priv->unclamped_vadj_value = gtk_adjustment_get_value (adjustment);
 }
 
 static void